package com.alliky.core.binding.viewadapter.image;


import android.text.TextUtils;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;

import com.alliky.core.util.ImageLoader;

/**
 * @Description TODO
 * @Author wxianing
 * @Date 2020-11-14
 */
public final class ViewAdapter {
    @BindingAdapter(value = {"url", "placeholderRes"}, requireAll = false)
    public static void setImageUri(ImageView imageView, String url, int placeholderRes) {
        if (!TextUtils.isEmpty(url)) {
            //使用Glide框架加载图片
            ImageLoader.loadImage(imageView.getContext(), url, imageView, placeholderRes);
        }
    }
}

